﻿using System;
using System.Collections.Generic;
using System.Text;
using Placid.Core;

namespace Placid.PivotSourceImpl
{
    public class PivotSourceColumn : IPivotSourceColumn
    {
        private string _name;
        private int _index;
        private int _sourceIndex;
        private PivotSource _container;

        internal protected PivotSourceColumn(string name, int index, PivotSource container, int sourceIndex)
        {
            if(container != null) {
                _container = container;
            } else throw new Exception("IPvSource Container is a null reference.");

            _name = name;
            _index = index;
            _sourceIndex = sourceIndex;
        }

        public PivotSource PvSource
        {
            get { return _container; }
        }

        internal protected int SourceIndex
        {
            get
            {
                return _sourceIndex;
            }
        }

        #region IPvSourceColumn Members

        public string Name
        {
            get { return _name; }
        }

        public int Index
        {
            get { return _index; }
        }

        public IPivotSource Container
        {
            get { return _container; }
        }

        #endregion

        public override string ToString()
        {
            return _name;
        }
    }
}
